package org.dromara.patrol.domain.vo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.patrol.domain.PatrolSnapPlan;
import org.dromara.patrol.domain.model.snap.DeviceChannel;
import org.dromara.patrol.domain.model.snap.SnapExecuteRule;

import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 巡店管理-巡店抓拍配置视图对象 patrol_snap_plan
 *
 * @author LionLi
 * @date 2024-03-27
 */
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = PatrolSnapPlan.class)
public class PatrolSnapPlanVo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 计划id
     */
    @ExcelProperty(value = "计划id")
    private Long planId;

    /**
     * 计划名称
     */
    @ExcelProperty(value = "计划名称")
    private String planName;

    /**
     * 门店id
     */
    @ExcelProperty(value = "门店id")
    private Long storeId;

    /**
     * 设备ids
     */
    @ExcelProperty(value = "设备ids")
    private List<Long> deviceIds;

//    /**
//     * 设备通道[
//{
//"deviceId": "24f2303f-8525-11ee-9bed-0329e3f31fb1","channelNo": [
//0,
//1,
//2,
//3
//]},
//{
//"deviceId": "60178e90-e119-11ea-9b05-49adcdf3e65a","channelNo": null}
//]
//     */
//    @ExcelProperty(value = "设备通道[
//{
//"deviceId": "24f2303f-8525-11ee-9bed-0329e3f31fb1","channelNo": [
//0,
//1,
//2,
//3
//]},
//{
//"deviceId": "60178e90-e119-11ea-9b05-49adcdf3e65a","channelNo": null}
//]")
    private List<DeviceChannel> deviceChannel;

    /**
     * 设备预设点
     */
    @ExcelProperty(value = "设备预设点")
    private String devicePresetPoint;

    /**
     * 最新抓拍地址
     */
    @ExcelProperty(value = "最新抓拍地址")
    private String latestImgUrl;

    /**
     * 快照总计
     */
    @ExcelProperty(value = "快照总计")
    private Long snapTotal;

    /**
     * 当前状态(0启用 1关闭)
     */
    @ExcelProperty(value = "当前状态(0启用 1关闭)")
    private String status;

    /**
     * 拍照时间、循环周期（如：{
                "cycleType": "WEEKLY",
                "weeklyRule": [
                    2,
                    3,
                    4,
                    5,
                    6
                ],
                "customRule": null,
                "snapTime": [
                    {
                        "startTime": "08:30",
                        "endTime": "09:00",
                        "interval": 600
                    }
                ]
            }）
     */
//    @ExcelProperty(value = "拍照时间、循环周期", converter = ExcelDictConvert.class)
//    @ExcelDictFormat(readConverterExp = "如=：{
//,"=cycleType":,"=WEEKLY",
//,"=weeklyRule":,[=
//,2=,
//,3=,
//,4=,
//,5=,
//,6=
//,]=,
//,"=customRule":,n=ull,
//,"=snapTime":,[=
//,{=
//,"=startTime":,"=08:30",
//,"=endTime":,"=09:00",
//,"=interval":,6=00
//,}=
//,]=
//,}=")
    private SnapExecuteRule executeRule;

    /**
     * 检查数量
     */
    @ExcelProperty(value = "检查数量")
    private Long inspectedNum;

    /**
     * 抓拍模式（字典表：COMMON 普通抓拍，LOCATION 预置位抓拍）
     */
    @ExcelProperty(value = "抓拍模式", converter = ExcelDictConvert.class)
    @ExcelDictFormat(readConverterExp = "字=典表：COMMON,普=通抓拍，LOCATION,预=置位抓拍")
    private String snapModel;

    /**
     * 预计抓拍图片总数
     */
    @ExcelProperty(value = "预计抓拍图片总数")
    private String expectSnapTotal;

    /**
     * ID,名称映射
     */
    private Map<Long, String> nameMap = new HashMap<>();
}
